<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
    <title>易装网_装修行业门户网站_优质装修资源整合平台_【易装网】</title>
    <style>
        body {
            background-image: url("imgs/background/Background picture1.webp");
            background-size: cover;/*把背景图片设置为封面*/
            background-repeat: no-repeat;
            text-align: center;
            font-size: 14px;
            font-family: 微软雅黑, "Microsoft Yahei", arial, 宋体, simsun;
            margin: 0;
            padding: 0;
            border: 0;
        }
        .top_a {
            width: 100%;
            height: 35px;
            position: relative;
            background-color: #f6f6f6;
        }
        .top_b {
            width: 100%;
            height: 80px;
            background-color: #fff;

        }
        .shouye {
            text-decoration: none
        }
        .el-header {
            width: 100%;
            background-color: #1b721b;
            position: fixed;
            z-index: 999;
        }
        .a {
            width: 100%;
            background-color: #282c30;
            text-align: center;
        }
        div {
            display: block;
        }
        a{
            color: #282c30;
            text-decoration: none;
        }
        .a > div {
            overflow: hidden;
            margin-top: 23px;
        }
        .weibu {
            color: white;
            margin-right: 20px;
        }
        .info_web {
            color: #6b6b6b;
        }
        .dis_detail {
            width: 400px;
            height: 150px;
            position: relative;
            top: -150px;
        }
        .q {
            color: white;
        }
    </style>
</head>
<body>
<div id="app">
    <el-container>
        <el-header >
            <div class="top_b" style="height: 60px">
                <el-menu mode="horizontal" background-color="#1b721b" style="height: 60px">
                    <el-menu-item index="1"><img src="imgs/易装网.png"
                                                 style="width: 100%;height: 100%;"></el-menu-item>
                    <el-menu-item index="2"><a class="shouye" href="/HomePage.html">首页</a></el-menu-item>
                    <el-submenu index="3">
                        <template slot="title"><a href="/learn.html">学装修</a></template>
                        <el-submenu index="3-1">
                            <template slot="title"><a href="/learn.html">按空间</a></template>
                            <el-menu-item index="3-1-1"><a href="/learn.html">客厅</a></el-menu-item>
                            <el-menu-item index="3-1-2"><a href="/learn.html">卧室</a></el-menu-item>
                            <el-menu-item index="3-1-3"><a href="/learn.html">餐厅</a></el-menu-item>
                        </el-submenu>
                        <el-submenu index="3-2">
                            <template slot="title"><a href="/learn.html">按风格</a></template>
                            <el-menu-item index="3-2-1"><a href="/learn.html">简约</a></el-menu-item>
                            <el-menu-item index="3-2-2"><a href="/learn.html">现代</a></el-menu-item>
                            <el-menu-item index="3-2-3"><a href="/learn.html">中式</a></el-menu-item>
                        </el-submenu>
                        <el-submenu index="3-3">
                            <template slot="title"><a href="/learn.html">按户型</a></template>
                            <el-menu-item index="3-3-1"><a href="/learn.html">小户型</a></el-menu-item>
                            <el-menu-item index="3-3-2"><a href="/learn.html">一居室</a></el-menu-item>
                            <el-menu-item index="3-3-3"><a href="/learn.html">二居室</a></el-menu-item>
                        </el-submenu>
                    </el-submenu>
                    <el-menu-item index="4"><a class="shouye" href="/rendering.html">效果图</a></el-menu-item>
                    <el-menu-item index="5"><a class="shouye" href="/shop.html">装修材料</a></el-menu-item>
                    </el-menu-item>
                    <el-menu-item><a class="shouye" href="/designer.html">设计师信息</a></el-menu-item>
                </el-menu>
            </div>
        </el-header>
        <el-main style="margin-top: 45px;z-index: 1">
            <div id="a1">
                <h1 style="font-size: 50px;margin: 0;color: #535050">用户登录</h1>
                <img style="width: 300px" src="imgs/易装网.png">
                <h2>Yi Zhuang Net</h2>
                <el-card style="width: 600px;height: 400px;
    background-color: rgba(255,255,255,0.3);margin: 0 auto">
                    <el-form label-width="60px" style="width: 400px;margin: 50px auto">
                        <el-form-item label="用户名" v-model="user.nickname">
                            <el-input type="text" v-model="user.nickname" placeholder="请输入用户名"></el-input>
                        </el-form-item>
                        <el-form-item label="密码"  v-model="user.password">
                            <el-input type="password" v-model="user.password" @keydown.native.enter="login()" placeholder="请输入密码"></el-input>
                        </el-form-item>
                        <el-form-item>
                            <a style="color: #0290dc;font-size: 20px " href="/reg.html">注册</a><br>
                            <el-checkbox v-model="user.rem">记住用户名和密码</el-checkbox>
                        </el-form-item>
                        <el-form-item>
                            <el-button style="position:relative;left: -30px" type="primary" @click="login()">登录</el-button>
                        </el-form-item>
                    </el-form>
                </el-card>
            </div>
        </el-main>
        <el-footer style="background-color: #282c30;height: 100%">
            <div class="a" style="margin: 0 auto">
                <div>
                    <a class="weibu" href="" target="_blank"><span>关于我们</span></a>
                    <a class="weibu" href="" target="_blank"><span>帮助中心</span></a>
                    <a class="weibu" href="" target="_blank"><span>联系我们</span></a>
                    <a class="weibu" href="" target="_blank"><span>VIP服务</span></a>
                </div>
                <el-row gutter="10">
                    <el-col span="6" >
                        <div style="margin: 0 auto">
                            <el-row gutter="10">
                                <el-col span="8">
                                    <img width="100" height="100" src="https://static.zhuangyi.com/css/index/img/ewm_m.png">
                                    <p class="q">手机版</p></el-col>
                                <el-col span="8">
                                    <img width="100" height="100" src="https://static.zhuangyi.com/css/index/img/ewm_xcx.jpg">
                                    <p class="q">小程序</p></el-col>
                                <el-col span="8">
                                    <img width="100" height="100" src="https://static.zhuangyi.com/css/index/img/ewm_wx.png">
                                    <p class="q">公众号</p></el-col>
                            </el-row>
                        </div>
                    </el-col>
                    <el-col span="18" >
                        <div class="info_web">
                            <p>Copyright © 2009-2023 zhuangyi.com All Rights Reserved</p>
                            <p>免责声明：本网站部分内容由用户自行上传，如权利人发现存在误传其作品情形，请及时与本站联系</p>
                            <p>河南车前草计算机科技有限公司 版权所有</p>
                        </div>
                    </el-col>
                </el-row>
            </div>
        </el-footer>
    </el-container>
</div>
</body>
<!--引入axios和vue框架文件-->
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
    let v = new Vue({
        el: '#app',
        data: function () {
            return {
                user:{nickname:"",password:"",rem:false}
            }
        },
        methods:{
            login(){
                axios.post("/login",v.user).then(function (response){
                    if(response.data==1){
                        //跳转到首页
                        location.href="/homepage.html"
                    }else if(response.data==2){
                        v.$message.error("密码错误")
                    }else {
                        v.$message.error("用户名不存在")
                    }
                })
            }
        },
        created:function () {
            //username=admin; password=123456
            let arr=document.cookie.split(";");
            let count=0;
            //遍历
            for (let cookieStr of arr) {
                let cookieArr=cookieStr.split("=")
                let key=cookieArr[0].trim()
                let value=cookieArr[1]
                if(key=='nickname'){
                    //如果在Vue对象初始化过程中访问对象时不能使用v 需要使用this
                    //如果此处发出异步请求后访问Vue对象 不能使用this必须使用v
                    this.user.nickname=value;
                    count++;
                }else if(key=='password'){
                    this.user.password=value;
                    count++;
                }
            }
            this.user.rem=count==2;
        }
    })
</script>
</html>